<script type="text/javascript" src="<?php bloginfo('template_url')?>/js/jquery-validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url')?>/inc/building/js/jquery.form.js"></script>
<?php if(ICL_LANGUAGE_CODE == 'vi'){?>
<script type="text/javascript" src="<?php bloginfo('template_url')?>/js/jquery-validate/localization/messages_vi.js"></script>
<?php }?>
<style>
span.error {
    clear: both;
    color: #FF0000;
    font-size: 12px;
}
#preview{display:none}
</style>
<script type="text/javascript">
jQuery(document).ready(function($){
	$("#register_building").validate({
		errorElement: "span"
	});
	$('input[type="file"]').each(function(){
		$(this).bind('change',function(){
			/*2097152*/
			if(this.files[0].size > 2097152){
				this.value = '';
				alert('<?php _e('File size less than 2M','building')?>');
			}
		});
	})
	$('#submit_building').bind('click',function(){		
		$("#preview").html('');
		$("#preview").html('<img src="<?php bloginfo('template_url')?>/images/loader.gif" alt="Uploading...."/>');
		$("#register_building").ajaxForm({	
			target: '#preview'			
		}).submit();
		return false;
	})	
});
</script>

<form method="POST" action="<?php echo home_url( 'wp-admin/admin-ajax.php' );?>" name="register_building" id="register_building">
	<input type="hidden" id="building_imgadv" name="imgadv"/> 
	<div id='preview'>
		
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Title *')?></div>
		<div class="row-right">
			<input type="text" name="post_title" class="ipt-100 required"/>
		</div>
	</div>	
	<div class="row">
		<div class="row-left"><?php _e('Type *')?></div>
		<div class="row-right">
			<select name="post_type_search">
				<option value="<?php _e('For Rent','building')?>"><?php _e('For Rent','building')?></option>
				<option value="<?php _e('For Sale','building')?>"><?php _e('For Sale','building')?></option>
			</select>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('District *')?></div>
		<div class="row-right">
			<input type="text" name="building_district" class="required"/>
		</div>
	</div>	
	<div class="row">
		<div class="row-left"><?php _e('Street *')?></div>
		<div class="row-right">
			<input type="text" name="building_street" class="ipt-100 required"/>
		</div>
	</div>	
	<div class="row">
		<div class="row-left"><?php _e('Address *')?></div>
		<div class="row-right">
			<input type="text" name="building_address" class="ipt-100 required"/>
		</div>
	</div>	
	<div class="row">
		<div class="row-left"><?php _e('Land Area *')?></div>
		<div class="row-right">
			<input type="text" name="building_land_area" class="number required"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Usable Area *')?></div>
		<div class="row-right">
			<input type="text" name="building_usable_area" class="number required"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Bedroom *')?></div>
		<div class="row-right">
			<select name="building_num_bedroom">
				<?php for($i=1 ; $i < 15 ; $i++){?>
					<option value="<?php echo $i;?>"><?php echo $i?></option>
				<?php }?>
			</select>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Cost *')?></div>
		<div class="row-right">
			<input type="text" name="building_cost" class="number required"/><?php _e('USD','building');?>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Currentcy *')?></div>
		<div class="row-right">
			<select name="building_currency">
				<option value="<?php _e('USD/WEEK','building')?>"><?php _e('USD/WEEK','building')?></option>
				<option value="<?php _e('USD/MONTH','building')?>"><?php _e('USD/MONTH','building')?></option>
				<option value="<?php _e('USD/YEAR','building')?>"><?php _e('USD/YEAR','building')?></option>
			</select>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Interior *')?></div>
		<div class="row-right">
			<select name="building_interior">				
				<option value="<?php _e('Fully Furnished','building')?>"><?php _e('Fully Furnished','building')?></option>
				<option value="<?php _e('Partly Furnished','building')?>"><?php _e('Partly Furnished','building')?></option>
				<option value="<?php _e('Unfurnished','building')?>"><?php _e('Unfurnished','building')?></option>
			</select>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Description *')?></div>
		<div class="row-right">
			<textarea type="textarea" name="building_content" class="textarea ipt-100 required"></textarea>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 1 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg1" accept="jpeg|gif|png|jpg" class="required"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 2 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg2" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 3 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg3" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 4 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg4" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 5 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg5" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 6 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg5" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 7 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg7" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Upload Photo 8 *')?></div>
		<div class="row-right">
			<input type="file" name="photoimg8" accept="jpeg|gif|png|jpg"/>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Allow test *')?></div>
		<div class="row-right">
			<select name="building_allow_test">				
				<option value="<?php _e('Yes','building')?>"><?php _e('Yes','building')?></option>
				<option value="<?php _e('No','building')?>"><?php _e('No','building')?></option>				
			</select>
		</div>
	</div>
	<div class="row">
		<div class="row-left"><?php _e('Extra infomation *')?></div>
		<div class="row-right">
			<textarea type="textarea" name="building_extra_infomation" class="textarea ipt-100"></textarea>
		</div>
	</div>
	<div class="row">
		<div class="row-left"> </div>
		<div class="row-right">			
			<input type="submit" value="Post" id="submit_building">
			<input class="btn-reset" type="reset" value="Reset">
			<input type="hidden" name="action" value="uploadImage"/>
		</div>
	</div>
</form>